Component({
  data: {
    selected: 0,
    "color": "#1f6ee4",
    "selectedColor": "#7763da",
    "list": [
      {
        "pagePath": "/pages/index/index",
        "text": "首页",
        "iconPath": "../static/tabBar/home.png",
        "selectedIconPath": "../static/tabBar/homeHL.png"
      },
      {
        "pagePath": "/pages/hcube/hcube",
        "text": "H²CUBE",
        "iconPath": "../static/tabBar/contact.png",
        "selectedIconPath": "../static/tabBar/contactHL.png"
      },
      {
        "pagePath": "/pages/officer/officer",
        "text": "白领事务官",
        "iconPath": "../static/tabBar/message.png",
        "selectedIconPath": "../static/tabBar/messageHL.png"
      },
      {
        "pagePath": "/pages/mine/mine",
        "text": "个人中心",
        "iconPath": "../static/tabBar/user.png",
        "selectedIconPath": "../static/tabBar/userHL.png"
      }
    ],
    showModal: false, // 显示modal弹窗
    single: true // false 只显示一个按钮，如果想显示两个改为true即可
  },
  attached() {
  },
  methods: {
    modalCancel(e) {
      console.log('点击了取消')
    },
    // 点击确定按钮的回调函数
    modalConfirm(e) {
      console.log('点击了确定')
    },
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      if(data.index === 2) {
        this.setData({
          showModal: true
        })
      } else if (data.index === 1) {
        wx.redirectTo({
          url: '/pages/outhcube/outhcube',
        })
      } else {
        this.setData({
          showModal: false
        })
        wx.switchTab({url})
      }
      this.setData({
        selected: data.index
      })     
    }
  }
})